package com.app.util.db.util;

import com.app.util.db.TableDefinedNoFoundException;
import com.app.util.db.bean.TableDefined;

public class TableDefinedUtil {

	/**
	 * 得到类的表定义，如果未设置则返回空
	 * 
	 * @param claxx
	 * @return
	 */
	public static TableDefined get(Class<?> claxx) {
		TableDefined tableDefined = claxx.getAnnotation(TableDefined.class);
		return tableDefined;
	}

	/**
	 * 得到类的表定义，如果未设置表定义则抛出TableDefinedNoFoundException
	 * 
	 * @param claxx
	 * @return 
	 */
	public static TableDefined ask(Class<?> claxx) {
		TableDefined tableDefined = get(claxx);
		if (null == tableDefined) {
			throw new TableDefinedNoFoundException(claxx);
		}
		return tableDefined;
	}
}